<template>
  <div>
<el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">
  <el-submenu index="2">
    <template slot="title" v-for="(i) in role_list">{{i.name}}</template>
 <span v-for="(i,j) in role_list" :key="j">
      <el-menu-item v-for="(x,j) in i.son">{{x.name}}</a></el-menu-item>
</span>


  </el-submenu>
</el-menu>
<div class="line"></div>
<el-menu
  :default-active="activeIndex2"
  class="el-menu-demo"
  mode="horizontal"
  @select="handleSelect"
  background-color="#545c64"
  text-color="#fff"
  active-text-color="#ffd04b">
  
</el-menu>
<div></div>
<p></p>
<p></p>
<el-button @click="epiboly">发布外包</el-button>
<el-button>买服务</el-button>
<el-button>招员工</el-button>
<hr width="100%" color="#EBEBEB" border='2px'>
<span v-for="(i,j) in ip_list" :key="j"> 
<el-link type="warning">&emsp;{{i.type_name}}&emsp;</el-link>&emsp;
</span>
  </div>
</template>

<script>
export default {
  data() {
      return {
        activeIndex: '1',
        activeIndex2: '1',
        role_list:localStorage.getItem("role_list"),
        ip_list:[],
        redurl:''
      };
    },
    methods: {
      handleSelect(key, keyPath) {
        console.log(key, keyPath);
      },
      get_ip_list(){
        this.axios.get('Get_Itype/').then((cg)=>{
          this.ip_list=cg.data.msg
          this.ip_list=JSON.parse(this.ip_list)
        })
      },
      epiboly(){
        this.axios.get('panduan/').then((cg)=>{
          if(cg.data.code==401){
            this.redurl=cg.data.url
            alert("检测到您未登录，即将跳转到登录页面")
            window.location.href=this.redurl
            return
          }
          if(cg.data.code==200){
            this.redurl=cg.data.url
            alert("即将跳转致发布页面")
            window.location.href=this.redurl
            return
          }
            if(cg.data.code==402){
            this.redurl=cg.data.url
            alert("检测到您未进行身份注册，即将跳转到身份绑定页面")
            window.location.href=this.redurl
            return
          }
          
          
          


        })
      }
    },
    mounted(){
      this.role_list=JSON.parse(this.role_list)
      this.get_ip_list()
    }
}
</script>

<style>

</style>